def maxSubArray2(self, nums: List[int]):
        # 数组中没有正数就没有合并的必要了
        tag = False
        for num in nums:
            if num > 0:
                tag = True
        if not tag:
            return max(nums)
        # 合并相邻同号的数
        i = 0
        while i < len(nums) - 1:
            if nums[i] * nums[i + 1] >= 0:  # 有0的话也合并
                nums[i] += nums[i + 1]
                nums.pop(i + 1)
                continue
            i += 1
        # 去头尾负数
        if nums[0] < 0:
            nums.pop(0)
        if nums[len(nums) - 1] < 0:
            nums.pop(len(nums) - 1)
        # 求最大
        max_num = 0
        length = len(nums)
        for k in range(0, length, 2):  # 以偶数的形式迭代, 由nums[k]起始
            sum_num = nums[k]
            max_num = max(max_num, sum_num)
            for i in range(2, length, 2):  # nums[k]后的i个数
                if k + i < length:
                    sum_num += nums[k + i] + nums[k + i - 1]
                    max_num = max(max_num, sum_num)
        return max_num